<%!

  Copyright (c) Facebook, Inc. and its affiliates.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

%><%#struct:fields_in_layout_order%><%#field:type%>
 <%field:visibility%>:
  <%#field:lazy?%>mutable <%/field:lazy?%><%field:cpp_storage_type%> <%field:cpp_name%>;
<%/field:type%><%/struct:fields_in_layout_order%>

<%#struct:private_isset?%>
 private:
<%/struct:private_isset?%>
<%^struct:private_isset?%>
 public:
<%/struct:private_isset?%>
<%#struct:isset_fields?%>
  [[deprecated("__isset field is deprecated in Thrift struct. Use _ref() accessors instead.")]]
<%#struct:private_isset?%>
  struct __isset {
<%/struct:private_isset?%>
<%^struct:private_isset?%>
  class __isset {
    friend class <%struct:name%>;
<%/struct:private_isset?%>
    std::array<uint8_t,<%struct:isset_fields_size%>> array_isset;
    template<size_t field_index>
    bool __fbthrift_get(folly::index_constant<field_index>) const {
      static_assert(field_index < <%struct:isset_fields_size%>, "Isset index is out of boundary");
      return array_isset[field_index] == 1;
    }
    template<size_t field_index>
    void __fbthrift_set(folly::index_constant<field_index>, bool isset_flag) {
      static_assert(field_index < <%struct:isset_fields_size%>, "Isset index is out of boundary");
      array_isset[field_index] = isset_flag ? 1 : 0;
    }
  } __isset = {};
<%/struct:isset_fields?%>
